DayOfWeek and WeekDay are equivalent functions. However, WeekDay is preferred in Basic syntax and DayOfWeek is preferred in Crystal syntax.
date is a Date value or dateTime value.
DayOfWeek determines the day of the week the given date falls on, and converts the day of the week to a Number (1 to 7). Optionally a numeric value for the first day of the week can be specified. If the first day of the week is not specified, Sunday is assumed.
Use this function any time you need to use the day of the week as a Number.
The following examples are applicable to Crystal syntax:
Returns 2 where October 1, 1990 is a Monday.
If DayOfWeek({orders.ORDER DATE}) = 3 Then
In determining whether Sam or Bill was on duty on September 8, 1990.
If DayOfWeek({orders.ORDER DATE}) = 7 Then
DayOfWeek(#Sept. 24, 1999#, crMonday)
Returns 5 where Sept. 24, 1999, is a Friday, and Monday is specified to be the first day of the week.
If you want to get the day of the week spelled out, in Crystal syntax, use this formula:
["Sun", "Mon", "Tues",...] [DayOfWeek(Date)]
Sets up an array (["Sun",...]) and uses the number of the day of the week (Sun = 1, Sat = 7) to select the desired date name from the array.
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |